package com.eco.fanliapp.service;

import com.eco.fanliapp.common.response.ServerResponse;
import com.eco.fanliapp.entity.AppUser;
import com.eco.fanliapp.entity.SyChannelGoods;
import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;

import java.util.List;

/**
 * <p>
 * 渠道商品对照表 服务类
 * </p>
 *
 * @author jobob
 * @since 2019-11-04
 */
public interface ISyChannelGoodsService extends IService<SyChannelGoods> {
	/**
	 * 获取渠道下所有单个商品高佣或者固定返
	 *
	 * @param type 0实时从数据库1优先从redis
	 * @return
	 */
	List<SyChannelGoods> getAllAppChannelGoods(int type);

	/**
	 * 获取渠道下商品
	 *
	 * @param itemId
	 * @param channelUserId
	 * @return
	 */
	SyChannelGoods getAppChannelGoods(String itemId, String channelUserId, int type);
	/**
	 * 根据公司和商品id查询该商品是否走特殊分佣
	 * @param appUser
	 * @param itemid
	 * @return
	 */
	SyChannelGoods selectByCompanyIdAndItemId(AppUser appUser, Long itemid);

	/**
	 * 特殊渠道分佣
	 * @param syChannelGoods
	 * @return
	 */
	Object getShemeNew(SyChannelGoods syChannelGoods);

    SyChannelGoods getSyChannelGoodsByItemId(Long itemId);

	ServerResponse<PageInfo> selectSyChannelGoods(Integer pageNum, Integer pageSize);

    int delectSyChannelGoods(Long tableId,Long itemId);

	ServerResponse updateSyChannelGoodsNew(SyChannelGoods syChannelGoods);

	//ServerResponse addSyChannelGoods(SyChannelGoods syChannelGoods,Integer companyId);

	ServerResponse addSyChannelGoodsNew(SyChannelGoods syChannelGoods,Integer companyId);

    SyChannelGoods selectByChannelAndItemId(Long itemId,Long channelId);


	/**
	 * 匹配所有有效商品，对比高佣固定返是否对称
	 * @return
	 */
	List<SyChannelGoods> findChannelGoodsCommission();
}
